<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<%@ include file="common.jsp" %>
<%@ page import="wargame.entity.*" %>
<%@ page import="module.ManageEmployee" %>

<%
            if (ManagePlayer.getThisPlayer(request) == null) {
                response.sendRedirect("login.jsp");
                return;
            }
            // Main Application Logic Comes Here
            ArrayList<Project> projects = ProjectDAO.retrieveAllBidableProjects();
            ArrayList<Bid> bids_of_this_player = BidDAO.retrieveAllBidsOfPlayer(ManagePlayer.getThisPlayer(request).getPlayer_id());
%>



<html>
    <c:set var="title" value="MIC Tycoon ~ Manage Project"/>
    <%@ include file="htmlheader.jsp" %>
    <body>

        <div id="resolution">
            <!-- HEADER -->
            <div id="header">
                <div id="calculator"><div id="budget-left">10,000,000</div></div>
                <div id="clock"><div id="time-left">00:00:00</div></div>
                <div id="calendar"><div id="current-turn">1</div></div>
                <div id="postit"><div id="guide">
                        <u>GUIDE</u><br />

                    </div></div>
            </div>

            <!-- BODY -->
            <div id="content">
                <%

                            //ArrayList<Project> all_incomplete_projects_by_player = ProjectDAO.retrieveAllIncompleteProjectsOfPlayer(ManagePlayer.getThisPlayer(request).getPlayer_id());
                            ArrayList<Project> all_incomplete_projects_by_player = ProjectDAO.retrieveAllIncompleteProjectsOfPlayer(1);
                            if (all_incomplete_projects_by_player.size() > 0) {
                %>
                <table border="1">
                    <tr align="center">
                        <td rowspan="2">Project ID</td>
                        <td rowspan="2">Project Offered By</td>
                        <td colspan="8">Man Hours Required</td>
                        <td rowspan="2">Bidded Amount</td>
                        <td rowspan="2">Turn Due</td>
                        <td rowspan="2">Action</td>

                    </tr>
                    <tr>
                        <td>.Net</td>
                        <td>C#</td>
                        <td>JSP</td>
                        <td>PHP</td>
                        <td>Ruby</td>
                        <td>MySQL</td>
                        <td>MsSQL</td>
                        <td>Oracle</td>
                    </tr>
                    <% for (int i = 0; i < all_incomplete_projects_by_player.size(); i++) {%>
                    <% Project p = all_incomplete_projects_by_player.get(i);%>
                    <tr>
                        <td><%=p.getProject_id()%></td>
                        <td><%=p.getOffered_by()%></td>
                        <td><%=p.getMan_hours_dot_net()%></td>
                        <td><%=p.getMan_hours_c_sharp()%></td>
                        <td><%=p.getMan_hours_jsp()%></td>
                        <td><%=p.getMan_hours_php()%></td>
                        <td><%=p.getMan_hours_ruby()%></td>
                        <td><%=p.getMan_hours_mysql()%></td>
                        <td><%=p.getMan_hours_mssql()%></td>
                        <td><%=p.getMan_hours_oracle()%></td>
                        <td><%=formatCurrency(p.getBidded_price())%></td>
                        <td><%=p.getDue_turn()%></td>
                    </tr>
                    <form method="post" action="./project/OutsourceProject2.do">
                        <tr>
                            <td colspan="2">
                                Outsource Project Portion
                            </td
                            <td>
                                <input type="text" name="dotnet" value="0" style="width: 40px">
                            </td>
                            <td>
                                <input type="text" name="csharp" value="0" style="width: 40px">
                            </td>
                            <td>
                                <input type="text" name="jsp" value="0" style="width: 40px">
                            </td>
                            <td>
                                <input type="text" name="php" value="0" style="width: 40px">
                            </td>
                            <td>
                                <input type="text" name="ruby" value="0" style="width: 40px">
                            </td>
                            <td>
                                <input type="text" name="mysql" value="0" style="width: 40px">
                            </td>
                            <td>
                                <input type="text" name="mssql" value="0" style="width: 40px">
                            </td>
                            <td>
                                <input type="text" name="oracle" value="0" style="width: 40px">
                            </td>
                            <td>
                                $<input type="text" name="price" value="0" style="width: 80px">
                            </td>
                            <td>
                                <input type="text" name="due_turn" value="<%=p.getDue_turn()%>" style="width: 80px">
                            </td>
                            <td>
                                <input type="hidden" name="project_id" value="<%=p.getProject_id()%>">
                                <input type="submit" value="Outsource">
                            </td>
                        </tr>
                    </form>
                    <% }%>
                </table>
                <% }%>
            </div>
        </div>
    </body>
</html>